{% extends "exam_system/base.html" %}
{% load static %}

{% block content %}
<div class="container mt-4">
    <div class="row">
        <!-- 左侧导航栏 -->
        <div class="col-md-3">
            <div class="card">
                <div class="card-header">
                    <h5 class="mb-0">考生中心</h5>
                </div>
                <div class="list-group list-group-flush">
                    <a href="{% url 'exam_system:dashboard' %}" class="list-group-item list-group-item-action">
                        <i class="fas fa-home"></i> 首页
                    </a>
                    <a href="{% url 'exam_system:exam_list' %}" class="list-group-item list-group-item-action">
                        <i class="fas fa-book"></i> 我的考试
                    </a>
                    <a href="{% url 'exam_system:exam_list' %}?filter=finished" class="list-group-item list-group-item-action">
                        <i class="fas fa-history"></i> 考试记录
                    </a>
                    <a href="{% url 'exam_system:profile' %}" class="list-group-item list-group-item-action active">
                        <i class="fas fa-user"></i> 个人信息
                    </a>
                </div>
            </div>
        </div>

        <!-- 右侧内容区 -->
        <div class="col-md-9">
            <div class="card">
                <div class="card-header">
                    <h5 class="mb-0">个人信息</h5>
                </div>
                <div class="card-body">
                    <div class="row mb-4">
                        <div class="col-md-3">
                            <strong>手机号</strong>
                        </div>
                        <div class="col-md-9">
                            {{ user.phone }}
                        </div>
                    </div>
                    <div class="row mb-4">
                        <div class="col-md-3">
                            <strong>姓名</strong>
                        </div>
                        <div class="col-md-9">
                            {{ user.name }}
                        </div>
                    </div>
                    <div class="row mb-4">
                        <div class="col-md-3">
                            <strong>电子邮箱</strong>
                        </div>
                        <div class="col-md-9">
                            {{ user.email|default:"未设置" }}
                        </div>
                    </div>
                    <div class="row mb-4">
                        <div class="col-md-3">
                            <strong>注册时间</strong>
                        </div>
                        <div class="col-md-9">
                            {{ user.date_joined|date:"Y-m-d H:i" }}
                        </div>
                    </div>
                    <div class="row mb-4">
                        <div class="col-md-3">
                            <strong>最后登录</strong>
                        </div>
                        <div class="col-md-9">
                            {{ user.last_login|date:"Y-m-d H:i" }}
                        </div>
                    </div>
                </div>
            </div>

            <!-- 考试统计 -->
            <div class="card mt-4">
                <div class="card-header">
                    <h5 class="mb-0">考试统计</h5>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-md-4">
                            <div class="card text-center">
                                <div class="card-body">
                                    <h3 class="card-title">{{ total_exams|default:"0" }}</h3>
                                    <p class="card-text">总考试数</p>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="card text-center">
                                <div class="card-body">
                                    <h3 class="card-title">{{ completed_exams|default:"0" }}</h3>
                                    <p class="card-text">已完成</p>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="card text-center">
                                <div class="card-body">
                                    <h3 class="card-title">{{ avg_score|default:"0" }}%</h3>
                                    <p class="card-text">平均得分率</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}